package pers.vankid.sessionkeeper.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import pers.vankid.sessionkeeper.service.SessionKeeperService;

/**
 * Created by shixj on 2018/5/22.
 */
@Component
@Configurable
@EnableScheduling
@EnableAsync
public class JobBeans {
    @Autowired
    private SessionKeeperService sessionKeeperService;


    /**
     * 每60分钟清理
     * 单位毫秒
     */
    @Async
    @Scheduled(fixedRate = 1000 * 60 * 60)
    public void clean() {
        sessionKeeperService.clean();
    }

}
